function message = result(algs, dataset, dataName,dataResult,indicator,candiname,w)
message = [];
tex_header = '\begin{table*}';
tex_header = [tex_header, char(13),'\caption{',dataset,'}'];
tex_header = [tex_header, char(13),'\tiny \centering \label{table:res_aio}'];
%tex_header = [tex_header, char(13),'\centering \label{table:res_aio} \setlength{\tabcolsep}{1.0pt}'];
tex_align = 'c';

tex_title = 'Data Sets';
for i1 = 1:length(algs)
    tex_title = [tex_title,  ' & ', algs{i1}];
    tex_align = [tex_align,' c '];
end
tex_title = [tex_title '\\ \hline'];
tex_header = [tex_header, char(13),'\begin{tabular}{', tex_align, '}'];
tex_header = [tex_header, char(13),'\toprule'];
Allmeanval=zeros(length(dataName),length(candiname));
 for i2 = 1:length(dataName)
        sigs = zeros(length(candiname), 1);
        sigs2 = [];
        meanval=[];
        stdval=[];
        for i3 = 1:length(candiname)
            candiname{i3}
        if  strcmp(candiname{i3},'coreg')||strcmp(candiname{i3},'rmsc')||strcmp(candiname{i3},'crsc') 
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',candiname{i3}]));
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_','amkkc_res_']));
            a=eval(['res_',candiname{i3}]);
            meanval=[meanval;mean(a(:,w),1)];
            stdval=[stdval;std(a(:,w),0,1)];
            [sigs(i3), sigs2(i3)] = ttest(a(:,w),res_amkkc);
        elseif strcmp(candiname{i3},'amkkc')
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_',candiname{i3},'_res_']));
            meanval=[meanval;mean(res_amkkc,1)];
            stdval=[stdval;std(res_amkkc,0,1)];  
            [sigs(i3), sigs2(i3)] = ttest(res_amkkc,res_amkkc);
        elseif  strcmp(candiname{i3},'rmkkm')
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_',candiname{i3},'_res_']));
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_','amkkc_res_']));
            a=eval(['res_',candiname{i3},'_aio']);
            meanval=[meanval;mean(a,1)];
            stdval=[stdval;std(a,0,1)];  
            [sigs(i3), sigs2(i3)] = ttest(a,res_amkkc);    
        else
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_',candiname{i3},'_res_']));
            load(fullfile(pwd,'metricresult', [dataResult{i2},'_',indicator,'_','amkkc_res_']));
            a=eval(['res_',candiname{i3}]);
            meanval=[meanval;mean(a,1)];
            stdval=[stdval;std(a,0,1)];  
            [sigs(i3), sigs2(i3)] = ttest(a,res_amkkc);
        end     
        end 
        message = [message, char(13), ms2tex(meanval,stdval, sigs, sigs2, dataName{i2})];
 
    Allmeanval(i2,:)= meanval';  
 end
  sigs = zeros(length(candiname), 1);
  sigs2 = [];
  stdval=[];
  message = [message, char(13), ms2tex(mean(Allmeanval,1),stdval, sigs, sigs2, 'Average')];
message = [tex_title, char(13), message ];
tex_end = [];
tex_end = [tex_end, char(13), '\bottomrule' ];
tex_end = [tex_end, char(13), '\end{tabular}' ];
tex_end = [tex_end, char(13), '\end{table*}' ];
message = [tex_header, char(13), message, char(13), tex_end];
message = strrep(message, '_', '-');
fid=fopen([dataset, '.tex'], 'w+');
fprintf(fid,'%s', message);
fclose(fid);
end
